﻿@{
    Layout = "~/Views/Shared/SettingMaster.cshtml";
}
@model Vote.Web.Models.ActionDetailsViewModel
<link href="~/ResStatic/JS/dhtmlgoodies_calendar/dhtmlgoodies_calendar.css" rel="stylesheet" type="text/css" />
<link href="~/ResStatic/CSS/ActionDetails.css" type="text/css" rel="stylesheet" />
<script src="~/ResStatic/JS/dhtmlgoodies_calendar/dhtmlgoodies_calendar.js" type="text/javascript"></script>
<script src="~/ResStatic/JS/voteresult.js?v=2" type="text/javascript"></script>
<script src="~/ResStatic/JS/model.js" type="text/javascript"></script>
<script src="~/ResStatic/JS/uploadimg.js" type="text/javascript"></script>
<script src="~/ResStatic/JS/jquery.form.js" type="text/javascript"></script>
<script type="text/javascript">  var action = @Html.Raw(ViewBag.action);  </script>


<ul class="breadcrumb">
    <li><a href="javascript:void(0);">菜单</a> <span class="divider">/</span></li>
    <li class="active">活动管理<span class="divider">/</span>编辑</li>
</ul>

<div class="container-fluid">
    <form id="UpLoadForm" name="UpLoadForm" method="post" enctype="multipart/form-data" action='/Utility/PicUploadHander.ashx'>
        <div class="row-fluid">
            @{
                if ("edit" == @ViewBag.a || "new" == @ViewBag.a)
                {
                    <table class="table list">
                        <tr>
                            <td>
                                活动名称：<input id="Actionname" type="text" class="input-xlarge" value="">
                                活动开始时间：
                                <input id="Begintime" type="text" class="input-xlarge" value="" onfocus="displayCalendar(this, 'yyyy-mm-dd hh:ii', this, true)">
                                <img src="~/ResStatic/Images/calendar.gif" alt="日历" title="点击选择活动结束时间" style="border: none" width="16" height="14"
                                     onclick="displayCalendar(document.getElementById('Begintime'), 'yyyy-mm-dd hh:ii', this, true)" />
                                &nbsp;&nbsp;
                                活动结束时间：
                                <input id="Endtime" type="text" class="input-xlarge" value="" onfocus="displayCalendar(this, 'yyyy-mm-dd hh:ii', this, true)">
                                <img src="~/ResStatic/Images/calendar.gif" alt="日历" title="点击选择活动结束时间" style="border: none" width="16" height="14"
                                     onclick="displayCalendar(document.getElementById('Endtime'), 'yyyy-mm-dd hh:ii', this, true)" />
                            </td>
                        </tr>
                        <tr style=" border-top: 0px;">
                            <td>活动介绍：<input id="ActionDesc" type="text" style="width:73%;" class="input-xlarge" value=""></td>
                        </tr>
                        <tr><td><a id="addGroup" class="addGroup" href="javascript:void(0);">添加分组</a></td></tr>
                        <tr>
                            <td colspan="2">
                                <ul class="group" id="grouplist">
                                    <li name="groupliitem" tip="1">
                                        <div style="margin-left: 25px;">
                                            分组名称：<input type="text" class="input-xlarge Groupname" style="width:45%" value="">
                                            <a name="addItem" class="addItem" href="javascript:void(0);">添加选项</a>
                                            <a name="removeGroup" href="javascript:void(0);" class=" removegroup">删除分组</a>
                                        </div>
                                        <div style="margin-left: 26px;">
                                            <span>投票范围：<input type="text" class="MinNum" value="1"> - <input type="text" class="MaxNum" value="2" style="padding-right:5px"></span>
                                            <span style="padding-left:25px">
                                                类型：
                                                <input type="radio" id="votetype10" checked="checked" name="votetype1" value="0" /><label style="display:inline;vertical-align:middle" for="votetype10">文字</label>&nbsp;&nbsp;&nbsp;&nbsp;
                                                <input type="radio" id="votetype11" name="votetype1" value="1" /><label style="display:inline;vertical-align:middle" for="votetype11">图文</label>&nbsp;&nbsp;&nbsp;&nbsp;
                                                <input type="radio" id="votetype12" name="votetype1" value="2" /><label style="display:inline;vertical-align:middle" for="votetype12">视频</label>
                                            </span>
                                        </div>
                                        <div style="margin-left: 25px;">
                                            分组介绍：<input type="text" name="groupdesc" class="input-xlarge" style="width:70%" value="">
                                        </div>
                                        <div>
                                            <ul class="item" name="optionlistul">
                                                <li name="optionItemli">
                                                    <div>
                                                        选项名称：<input type="text" class="input-xlarge Itemname" style="width:70%" value=""><a name="removeItem" class="removeItem" href="javascript:void(0);">删除选项</a>
                                                    </div>
                                                    <div name="uploaddiv" style="display:none">
                                                        上传图片：<input type="file" id="1234123412" name="btnfile" class="input-xlarge Imageurl" style="width:70%" value="" tip="" onchange="previewImage(this)">
                                                        <input type="hidden" name="uploadimgname" value="" /><br />
                                                        <div name="preview" style=" margin-left: 70px;margin-bottom: 10px;">
                                                            <img name="imghead" width=300 height=149 border=0 src='~/ResStatic/Images/noimage.png' />
                                                        </div>
                                                    </div>

                                                    <div name="videodiv" style="display:none">视频地址：<input name="videourl" type="text" class="input-xlarge Videourl" style="width:70%" value="" placeholder="请输入优酷视频地址"></div>
                                                    <div name="votedescdiv" style="display:none">选项描述：<textarea name="votedesc" rows="3" class="input-xlarge votedesc" style="width:70%"></textarea></div>
                                                </li>
                                                <li name="optionItemli">
                                                    <div>
                                                        选项名称：<input type="text" class="input-xlarge Itemname" style="width:70%" value=""><a class="removeItem" name="removeItem" href="javascript:void(0);">删除选项</a>
                                                    </div>
                                                    <div name="uploaddiv" style="display:none">
                                                        上传图片：<input type="file" id="1234123412" name="btnfile" class="input-xlarge Imageurl" style="width:70%" value="" onchange="previewImage(this)">
                                                        <input type="hidden" name="uploadimgname" value="" /><br />
                                                        <div name="preview" style=" margin-left: 70px;margin-bottom: 10px;">
                                                            <img name="imghead" width=300 height=149 border=0 src='~/ResStatic/Images/noimage.png' />
                                                        </div>
                                                    </div>

                                                    <div name="videodiv" style="display:none">视频地址：<input name="videourl" type="text" class="input-xlarge Videourl" style="width:70%" value="" placeholder="请输入优酷视频地址"></div>
                                                    <div name="votedescdiv" style="display:none">选项描述：<textarea name="votedesc" rows="3" class="input-xlarge votedesc" style="width:70%"></textarea></div>
                                                </li>
                                            </ul>
                                        </div>
                                    </li>


                                </ul>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <a style="margin-left:35%;" class="btn btn-info" id="saveAction" href="javascript:void(0);">保存</a>
                                <button aria-hidden="true" style="margin-left:2%;" class="btn" onclick="javascript:history.go(-1);">取消</button>
                            </td>
                        </tr>
                    </table>
                }
                else
                {
                    if (@Model.GroupList.Count == 0)
                    {
                        <div class="alert alert-info">
                            <button data-dismiss="alert" class="close" type="button">×</button>
                            <strong>提示：</strong> 没有添加分组和选项！
                        </div>
                    }
                    else
                    {


                        <div class="actiontitle">
                            <h2>
                                @Model.ActionName
                                <span>活动开始时间:@Model.Begintime.ToString("yyyy-MM-dd HH:mm")</span>
                                <span>活动结束时间:@Model.Endtime.ToString("yyyy-MM-dd HH:mm")</span>
                            </h2>
                        </div>

                        foreach (var group in Model.GroupList)
                        {
                            <div class="span11">
                                <div class="block">
                                    <p class="block-heading">@group.Groupname</p>
                                    <div class="block-body">
                                        <div class="row-fluid">
                                            <ul class="voteitem">
                                                @{
                            foreach (var result in @group.VoteResult)
                            {
                                <li><p>@result.ItemName</p></li>
                            }
                                                }


                                            </ul>
                                        </div>
                                        <div class="clearfix"></div>
                                    </div>
                                </div>
                            </div>
                        }

                    }


                }
            }
        </div>

    </form>
</div>